package com.cicc.txn.dom.desk.txn.olap.service.impl;

import com.cicc.its.desk.txn.olap.service.DubboTestService;
import com.cicc.its.desk.txn.olap.service.entity.DubboTest;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.shenyu.client.apidocs.annotations.ApiDoc;
import org.apache.shenyu.client.apidocs.annotations.ApiModule;
import org.apache.shenyu.client.dubbo.common.annotation.ShenyuDubboClient;

import java.util.Random;


@DubboService
@ApiModule(value = "dubboTestService")
public class DubboTestServiceImpl implements DubboTestService {
    @Override
    @ShenyuDubboClient("/findById")
    @ApiDoc(desc = "findById")
    public DubboTest findById(final String id) {
        return new DubboTest(id, "hello world shenyu Apache, findById");
    }

    @Override
    @ShenyuDubboClient("/findAll")
    @ApiDoc(desc = "findAll")
    public DubboTest findAll() {
        return new DubboTest(String.valueOf(new Random().nextInt()), "hello world shenyu Apache, findAll");
    }

    @Override
    @ShenyuDubboClient("/insert")
    @ApiDoc(desc = "insert")
    public DubboTest insert(final DubboTest dubboTest) {
        dubboTest.setName("hello world shenyu Apache Dubbo: " + dubboTest.getName());
        return dubboTest;
    }
}
